﻿using System;
using System.Collections.Generic;
using System.Text;

namespace BaseSimpleDao
{
    /// <summary>
    /// 列表过滤标签的扩展类
    /// (重写添加函数方便使用快捷语法添加过滤对象)
    /// </summary>
    public static class ListFilterEx
    {
        public static void Add(this List<BaseFilter> _list, string key, string operation, object value)
        {
            _list.Add(new BaseFilter { Key = key, Operation = operation, Value = value });
        }

        public static void Add(this List<BaseFilter> _list, string key, object value)
        {
            _list.Add(new BaseFilter { Key = key, Operation = "=", Value = value });
        }
    }

    /// <summary>
    /// 过滤器
    /// </summary>
    public struct BaseFilter
    {
        /// <summary>
        /// 验证数据列
        /// </summary>
        public string Key { get; set; }

        /// <summary>
        /// 验证数据内容
        /// </summary>
        public object Value { get; set; }

        /// <summary>
        /// 验证操作符
        /// </summary>
        public string Operation { get; set; }
    }
}
